<?php

namespace app\api\controller\v1;
use app\api\controller\Base;
use app\api\service\R;
use think\facade\Request;
use app\common\model\StCard;


class Payment extends Base
{
    /**收银支付
     * @param Request $request
     * @return \think\response\Json
     */
    public function Payment(Request $request)
    {
        if (!$this->request->isPost()) return R::error();

        $isRes      = $request::param("isReserve"); //是否预定了
        $payType    = $request::param("payType"); //卡类型
        $cardCode   = $request::param('cardCode');//二维码内容
        $payAmount  = $request::param('payAmount');//支付金额

        if (empty($cardCode)) return R::error('付款码异常');
        if ($payType=="FC" && $payAmount<=0) return R::error('付款金额不能为0元');
//      FCB177200462745d  CCB255685676275d
        return  (new StCard())->ApiPayment($payType,$cardCode,$payAmount,$isRes);

    }


}